home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2003 May / cmycha200305.iso / MutantStorm / setup_mutantstorm_demo.exe / {app} / script / actor.lua < prev    next >
Text File  |  2002-09-07  |  6KB  |  255 lines

  1. -- leave me
  2. -- cur_level_num = 0
  3. -- frame counter
  4. ticker = 0
  5. actor_unique_id = 1
  6.  
  7. setter = 0
  8. function fool( a, b, c )
  9. if setter == 0 then
  10.     setglobal( b, c )
  11. else
  12.     write( b, " ", a, "\n")
  13. end
  14. end
  15.  
  16. dofile("actor_table.lua")
  17.  
  18.  
  19. exp_no_align = 0
  20. exp_align = 1
  21.  
  22. health_chunk_regain    = 1
  23. health_damagable = 2
  24. health_damagable_check_parent = 3
  25. health_no_damage_check_parent_and_drop = 4
  26.  
  27.  
  28. _ACTOR = {}
  29.  
  30. function _ACTOR:setposn( x, y, z )
  31.     self[ci_posn_x] = x
  32.     self[ci_posn_y] = y
  33.     self[ci_posn_z] = z
  34. end
  35.  
  36. function _ACTOR:setanimdelay( anim_delay )
  37.     self[ci_anim_delay] = anim_delay
  38. end
  39.  
  40. function _ACTOR:setall( x, y, z, angle, size, hueshift, launch_delay, path_name )
  41.     self[ci_posn_x] = x
  42.     self[ci_posn_y] = y
  43.     self[ci_posn_z] = z
  44.     self[ci_angle] = angle
  45.     self[ci_model_size] = size
  46.     self[ci_hue_shift] = hueshift
  47.     self[ci_launch_delay] = launch_delay
  48.     if path_name ~= nil then
  49.         self[ci_path_name] = path_name
  50.     end
  51. end
  52.  
  53. function _ACTOR:launch()
  54.     c_launch_new_actor( self )
  55. end
  56.  
  57. function ACTOR_PreLaunch( actor_code, unique_name )
  58.     local n = {}
  59.  
  60.     actor_unique_id = actor_unique_id + 1
  61.  
  62.     n[ci_actor_name]        = actor_code
  63.     if unique_name == nil then
  64.         n[ci_unique_name]        = ""
  65.     else
  66.         n[ci_unique_name]        = unique_name
  67.     end
  68.     n[ci_path_name]            = ""
  69.  
  70.     n[ci_model_size]        = 0.0
  71.     n[ci_posn_x]            = 0.0
  72.     n[ci_posn_y]            = 0.0
  73.     n[ci_posn_z]            = 0.0
  74.     n[ci_angle]                = 0.0
  75.     n[ci_anim_delay]        = 0.0
  76.     n[ci_hue_shift]            = 0.0
  77.     n[ci_launch_delay]        = 0.0
  78.  
  79.     n.setposn                = _ACTOR.setposn
  80.     n.setanimdelay            = _ACTOR.setanimdelay
  81.     n.setall                = _ACTOR.setall
  82.     n.launch                = _ACTOR.launch
  83.  
  84.     return n
  85. end
  86.  
  87.  
  88. function ACTOR_preload()
  89.     local actor = {}
  90.  
  91.     c_change_bitmap( "", "" )
  92.  
  93. -- use as template
  94.     actor[cp_actor_name]            = ""
  95.     actor[cp_model_dir]                = ""
  96.     actor[cp_model_name]            = ""
  97.  
  98.     actor[cp_actor_type]            = cat_beastie
  99.     actor[cp_hit_delay]                = 0.01
  100.     actor[cp_mutate_hit_delay]        = 0.01
  101.     actor[cp_move_type]                = 0
  102.     actor[cp_weight]                = 0.0
  103.     actor[cp_hit_power]                = 0.0
  104.     actor[cp_i_collide_with_beasties]    = cat_player
  105.     actor[cp_these_collide_with_me]        = cat_player + cat_bullet
  106.     actor[cp_i_avoid_these_beasties]    = 0
  107.     actor[cp_in_beastie_count]        = 1
  108.     actor[cp_in_screen_zoom_box]    = 0
  109.  
  110.     -- movement
  111.     actor[cp_move_speed_min]        = 0.0
  112.     actor[cp_move_speed_max]        = 0.0
  113.     actor[cp_move_acceleration]        = 0.0
  114.     actor[cp_move_deceleration]        = 0.0
  115.     actor[cp_move_inertia_accn]        = 0.0
  116.     actor[cp_move_inertia_decn]        = 0.0
  117.  
  118.     actor[cp_burst_length_min]        = 0.0
  119.     actor[cp_burst_length_max]        = 0.0
  120.     actor[cp_burst_delay_min]        = 0.0
  121.     actor[cp_burst_delay_max]        = 0.0
  122.  
  123.     actor[cp_look_ahead_dist]        = 0.0
  124.     actor[cp_repel_dist]            = 0.0
  125.     actor[cp_target_stop_dist]        = 0.0
  126.     actor[cp_target_delay_min]        = 0.01
  127.     actor[cp_target_delay_max]        = 0.05
  128.  
  129.     actor[cp_turn_lock_angle_inner]        = 360.0
  130.     actor[cp_turn_lock_angle_outer]        = 360.0
  131.     actor[cp_turn_speed_still]            = 0.0
  132.     actor[cp_turn_acceleration_still]    = 0.0
  133.     actor[cp_turn_inertia_still]        = 0.0
  134.     actor[cp_turn_speed_moving]            = 0.0
  135.     actor[cp_turn_acceleration_moving]    = 0.0
  136.     actor[cp_turn_inertia_moving]        = 0.0
  137.     actor[cp_turn_speed_aiming]            = 0.0
  138.  
  139.     actor[cp_health_regain]            = 0.0
  140.     actor[cp_health_percent]        = 100.0
  141.     actor[cp_health_type]            = 0.0
  142.     actor[cp_health_byebye_percent]    = 0.0
  143.  
  144.     actor[cp_launch_scale_min]            = 100.0
  145.     actor[cp_launch_scale_max]            = 100.0
  146.     actor[cp_launch_hue_shift]            = 0.0
  147.  
  148.     actor[cp_bullet_spray_angle]    = 0.0
  149.     actor[cp_blank]    = 1.0
  150.     actor[cp_player_bullet_rate]    = 0.1
  151.  
  152.     actor[cp_random_offset_x]            = 0.0
  153.     actor[cp_random_offset_z]            = 0.0
  154.  
  155.     actor[cp_random_trajectory_offset]                = 0.0
  156.     actor[cp_random_trajectory_offset_delay_min]    = 0.0
  157.     actor[cp_random_trajectory_offset_delay_max]    = 0.0
  158.  
  159.     actor[cp_random_edge_inner_percent]    = 0.0
  160.     actor[cp_random_edge_outer_percent]    = 90.0
  161.  
  162.     actor[cp_fence_bounce_percent]        = 50.0
  163.     actor[cp_max_explosion_multiply]    = 0.0
  164.  
  165.     actor[cp_rolly_polly_multiply]    = 0.0
  166.     actor[cp_angle_grid_size]        = 0.0
  167.  
  168.     actor[cp_num_spawn_min]            = 1.0
  169.     actor[cp_num_spawn_max]            = 1.0
  170.     actor[cp_scale_spawn_min]        = 100.0
  171.     actor[cp_scale_spawn_max]        = 100.0
  172.  
  173.     actor[cp_score]                    = 0
  174.     actor[cp_bonus_seq_hit]            = 0
  175.     actor[cp_bonus_seq_score]        = 0
  176.     actor[cp_level_end_score]        = 0
  177.  
  178.     actor[cp_geopus_style]            = 0
  179.     actor[cp_fade_in_translucent]    = 0
  180.  
  181.     actor[cp_multiple_beast_shoot_rate]    = 0.0
  182.     actor[cp_multiple_beast_base_num]    = 0.0
  183.     actor[cp_difficulty_adjust_speed]    = 100.0
  184.     actor[cp_difficulty_adjust_shoot]    = 100.0
  185.  
  186. --    actor[cp_delay_at_path_point_min]    = 0.0
  187. --    actor[cp_delay_at_path_point_max]    = 0.0
  188.  
  189.     actor[cp_spin_speed_min]    = 0.0
  190.     actor[cp_spin_speed_max]    = 0.0
  191.  
  192.     actor[cp_i_am_repelled_by]        = 0
  193.     actor[cp_move_target]            = "track_player"
  194. --    actor[cp_repel_target]            = ""
  195. -- use as template
  196.  
  197.     return actor
  198. end
  199.  
  200.  
  201. w_gun_type            = 2
  202. w_gun_bone_name        = 3
  203. w_shaft_bone_name    = 4
  204. w_fire_anim_name    = 5
  205. w_aim_anim_name        = 6
  206. w_flare_exp_name    = 7
  207. w_flare_exp_scale    = 8
  208. w_aim_delay            = 9
  209. w_bullet_scale        = 10
  210. w_barrel_offset        = 11
  211. w_no_shoot_dist        = 12
  212. w_no_shoot_angle    = 13
  213. w_recoil_angle        = 14
  214. w_recoil_dist        = 15
  215. w_reload_random        = 16
  216.  
  217. function WEAPON_preload( actor_code )
  218.     local n = {}
  219.  
  220.     n[ci_actor_name]        = actor_code
  221.     n[w_gun_type]            = "no_bone_aim"
  222.     n[w_gun_bone_name]        = ""
  223.     n[w_shaft_bone_name]    = ""
  224.     n[w_fire_anim_name]        = ""
  225.     n[w_aim_anim_name]        = ""
  226.     n[w_flare_exp_name]        = ""
  227.     n[w_flare_exp_scale]    = 100.0
  228.     n[w_aim_delay]            = 1.0
  229.     n[w_bullet_scale]        = 100.0
  230.     n[w_barrel_offset]        = 0.0
  231.     n[w_no_shoot_dist]        = 9.0
  232.     n[w_no_shoot_angle]        = 0.0
  233.     n[w_recoil_angle]        = 0.0
  234.     n[w_recoil_dist]        = 0.0
  235.     n[w_reload_random]        = 0.0
  236.  
  237.     return n
  238. end
  239.  
  240. function WEAPON_add( n, seq )
  241.     c_add_a_weapon( n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8], n[9], n[10], n[11], n[12], n[13], n[14], n[15], n[16], seq )
  242. end
  243.  
  244.  
  245. function dofile_lua( filename )
  246.     local isloaded = c_is_model_preloaded( filename )
  247. --    c_print( filename, isloaded )
  248.     if isloaded ~= 0 then
  249.         local filename_lua = format( "%s.lua", filename )
  250.         dofile( filename_lua )
  251.     end
  252. end
  253.  
  254. -- leave me
  255.